package object;
/*
    想比较2个对象是否相等比较的是对象的属性值是否相同而不是地址值是否相同!
 */
public class ObjectDemo2 {
    public static void main(String[] args) {
        Student stu1 = new Student(null, 18);
        Student stu2 = new Student("古力娜扎", 19);
        Student stu3 = new Student(null, 18);
        //(this == obj);
        System.out.println("stu1.equals(stu2) = " + stu1.equals(stu2));//false
        System.out.println("stu1.equals(stu3) = " + stu1.equals(stu3));//true
        //System.out.println("stu1.equals(stu3) = " + stu1.equals(new Random()));//true
    }
}
